package com.giantlizard.cloud.api.service;


import com.giantlizard.cloud.api.factory.RemoteUserFallbackFactory;
import com.giantlizard.cloud.base.constants.ServiceNameConstants;
import com.giantlizard.cloud.base.entity.SysRole;
import com.giantlizard.cloud.base.entity.SysUser;
import com.giantlizard.cloud.base.generics.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * 用户服务
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService
{
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @return 结果
     */
    @GetMapping("/system/user/info/{username}")
    R<SysUser> getUserInfo(@PathVariable("username") String username);

    @GetMapping("/system/user/roles/{userId}")
    R<List<SysRole>> selectRoleByUserId(@PathVariable("userId") String userId);
}
